package com.wyx.controller;


import com.wyx.mapper.UserMapper;
import com.wyx.pojo.User;
import com.wyx.service.UserService;
import com.wyx.utils.CommonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 用户表 前端控制器
 * </p>
 *
 * @author 王玉星
 * @since 2021-08-03
 */
@RestController
@RequestMapping("/user")
public class UserController {

    @Autowired
    UserService userService;

    @GetMapping("/get/{id}")
    public CommonResult getId(@PathVariable String id){
        User user = userService.getById(id);
        return (user == null) ? CommonResult.isNull():CommonResult.Success(user);
    }
}

